package main

import (
	"context"
	"fmt"
	"go_final/demos/grpc_quick_start/server/proto"

	"google.golang.org/grpc"
)

func main() {
	// 1.建立连接
	conn, err := grpc.Dial(":8081", grpc.WithInsecure())
	if err != nil {
		panic(err)
	}

	// 2.defer关闭连接
	defer conn.Close()

	// 3.创建client
	client := proto.NewHelloClient(conn)

	// 4.调用方法
	res, _ := client.Hello(context.Background(), &proto.HelloRequest{
		Name: "Chan",
		Age:  19,
		Courses: []string{
			"golang",
		},
	})

	fmt.Println("res", res)
}
